//
//  TravelTableViewCell.m
//  chanyou
//
//  Created by wanli on 15/1/2.
//  Copyright (c) 2015年 wanli. All rights reserved.
//

#import "TravelTableViewCell.h"
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#import "Masonry.h"
@implementation TravelTableViewCell

- (void)dealloc
{
    [_descrip release];
    [_name release];
    [_image_urlView release];
    [_attraction_trips_count release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.image_urlView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH /3, SCREEN_HEIGHT / 6 - 20)];
//        [_image_urlView release];
        self.image_urlView = [[UIImageView alloc] init];
        [self.contentView addSubview:_image_urlView];
        
        [_image_urlView release];
        
        self.attraction_trips_count = [[UILabel alloc] init];
        [_image_urlView addSubview:_attraction_trips_count];
        
        _attraction_trips_count.font = [UIFont boldSystemFontOfSize:12];
        [_attraction_trips_count setTextColor:[UIColor whiteColor]];
        [_attraction_trips_count release];
        
        self.name = [[UILabel alloc] init];
        [self.contentView addSubview:_name];
        
//        self.name = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 3 + 20, 10, 200, 30)];
        _name.font = [UIFont systemFontOfSize:16];
        [_name release];
        
        self.descrip = [[UILabel alloc] init];
        [self.contentView addSubview:_descrip];
        
//        self.descrip = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 3 + 20, 40, 200, 60)];
        _descrip.font = [UIFont systemFontOfSize:14];
        _descrip.alpha = 0.7;
        _descrip.numberOfLines = 0;
        [_descrip release];
        
   
    }
    return self;
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    [_image_urlView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(@5);
        make.width.mas_equalTo(@(SCREEN_WIDTH / 3));
        make.height.mas_equalTo(@(SCREEN_HEIGHT / 6 - 20));
    }];
    
    [_attraction_trips_count mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(@(- 5));
        make.left.mas_equalTo(@20);
    }];
    
    [_name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(@(SCREEN_WIDTH / 3 + 10));
    }];
    
    [_descrip mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(@(SCREEN_WIDTH / 3 + 10));
        make.top.mas_equalTo(@20);
        make.bottom.mas_equalTo(-5);
        make.right.equalTo(self.contentView.mas_right);
    }];
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
